<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>房联行增值服务部后台管理中心</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="stylesheet" href="./css/font.css">
		<link rel="stylesheet" href="./css/xadmin.css">
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="./js/xadmin.js"></script>
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	</head>

	<body>
		<div class="x-body">
			<form class="layui-form" action="">

				<div class="layui-form-item center">
					<label class="layui-form-label">案例主图</label>
					<div class="layui-inline" style="margin:0px">
						<img class="layui-upload-img" id="img_show" height="132" style="max-width: 190px;" src="">
						<p id="demoText"></p>
					</div>
					<div class="layui-inline">
						<div class="layui-field-box" style="padding:0px;">
							<div class="layui-upload-drag" id="img">
								<i class="layui-icon layui-icon-add-circle-fine"></i>
								<p>点击添加案例主图</p>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">案例标题</label>
						<div class="layui-input-inline">
							<input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入案例标题" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">装修方式</label>
						<div class="layui-input-inline">
							<select name="method">
								<option value="">请选择</option>
								<option value="">半包</option>
								<option value="">全包</option>
								<option value="">套餐</option>
							</select>
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">装修费用</label>
						<div class="layui-input-inline">
							<input type="number" name="price" lay-verify="price" autocomplete="off" placeholder="元/平米" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">装修风格</label>
						<div class="layui-input-inline">
							<select name="style">
								<option value="">请选择</option>
								<option value="">混搭</option>
								<option value="">欧式/简欧</option>
								<option value="">中式</option>
								<option value="">新古典</option>
								<option value="">东南亚</option>
								<option value="">美式</option>
								<option value="">北欧</option>
								<option value="">地中海</option>
								<option value="">现代/简约</option>
								<option value="">日式</option>
							</select>
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">装修居室</label>
						<div class="layui-input-inline">
							<select name="room">
								<option value="">请选择</option>
								<option value="">混小公寓搭</option>
								<option value="">平层</option>
								<option value="">复式</option>
								<option value="">大宅</option>
								<option value="">别墅</option>
								<option value="">局部改造</option>
							</select>
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">使用面积</label>
						<div class="layui-input-inline">
							<input type="number" name="area" lay-verify="area" autocomplete="off" placeholder="平米" class="layui-input">
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">施工小区</label>
						<div class="layui-input-inline">
							<input type="text" name="community" lay-verify="community" autocomplete="off" placeholder="请输入施工小区" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">装修公司</label>
						<div class="layui-input-inline">
							<select name="company">
								<option value="">请选择</option>
								<option value="">洛阳椿庭装饰工程有限公司</option>
								<option value="">六合内筑空间设计机构</option>
								<option value="">洛阳天俊装饰工程有限公司</option>
								<option value="">洛阳椿庭装饰工程有限公司</option>
								<option value="">洛阳天俊装饰工程有限公司</option>
								<option value="">六合内筑空间设计机构</option>
							</select>
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">设计师</label>
						<div class="layui-input-inline">
							<select name="designer">
								<option value="">请选择</option>
								<option value="">设计师</option>
								<option value="">设计师</option>
								<option value="">设计师</option>
								<option value="">设计师</option>
								<option value="">设计师</option>
								<option value="">设计师</option>
							</select>
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">工长</label>
						<div class="layui-input-inline">
							<select name="foreman">
								<option value="">请选择</option>
								<option value="">工长</option>
								<option value="">工长</option>
								<option value="">工长</option>
								<option value="">工长</option>
								<option value="">工长</option>
								<option value="">工长</option>
							</select>
						</div>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<label class="layui-form-label">行政区域</label>
						<div class="layui-input-inline">
							<input type="text" name="xz_area" lay-verify="xz_area" autocomplete="off" placeholder="请输入行政区域" class="layui-input">
						</div>
					</div>

				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">设计理念</label>
					<div class="layui-input-block">
						<input type="text" name="design_idea" lay-verify="design_idea" autocomplete="off" placeholder="请输入行政区域" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item" style="margin:50px auto 20px auto; text-align: center;">
					<button class="layui-btn p40" lay-filter="add" lay-submit="" id="addfrom">提交</button>
					<button type="reset" class="layui-btn p40 layui-btn-primary">重置</button>
				</div>
			</form>
		</div>
		<script>
			layui.use(['form', 'layer', 'element', 'upload'], function() {
				var $ = layui.jquery
				var form = layui.form,
					layer = layui.layer,
					upload = layui.upload;
				//普通图片上传
				var uploadInst = upload.render({
					elem: '#img',
					exts: 'jpg|png|jpeg', //只允许上传图片格式
					size: 60, //限制文件大小，单位 KB
					url: '/upload/',
					before: function(obj) {
						//预读本地文件示例，不支持ie8
						obj.preview(function(index, file, result) {
							$('#img_show').attr('src', result); //图片链接（base64）
						});
					},
					done: function(res) {
						//如果上传失败
						if(res.code > 0) {
							return layer.msg('上传失败');
						}
						//上传成功
					},
					error: function() {
						//演示失败状态，并实现重传
						/*var demoText = $('#demoText');
						demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
						demoText.find('.demo-reload').on('click', function() {
							uploadInst.upload();
						});*/
					}
				});

				//监听提交
				form.on('submit(add)', function(data) {
					console.log(data);
					//发异步，把数据提交给php
					layer.alert("增加成功", {
						icon: 6
					}, function() {
						// 获得frame索引
						var index = parent.layer.getFrameIndex(window.name);
						//关闭当前frame
						parent.layer.close(index);
					});
					return false;
				});
			});
		</script>

	</body>

</html>